<body>
<p>Test shared worker garbage collection. Should print "PASS" followed by "DONE".</p>
<div id=result></div>
<script src="../../../resources/gc.js"></script>
<script>
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var worker = new SharedWorker('../resources/shared-worker-common.js', 'name');
worker.port.onmessage = handleMessage;
worker.port.postMessage("ping");
worker = 0;
gc();

function handleMessage(event) {
    log(event.data);
    log("DONE");
    if (window.testRunner)
        testRunner.notifyDone();
};
</script>
</body>
